Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(signature-v4): sort query parameter keys after encoding #1404

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

r-izumida
Copy link
Contributor

When signing an HTTP request with SigV4, an incorrect signature will be generated if the query parameter key contains characters that need to be encoded.

The following query parameter reproduces it: ?params[page]=1&params[pageSize]=20

According to the AWS documentation, it seems that query parameters need to be sorted after encoding.

CanonicalQueryString – The URI-encoded query string parameters. You URI-encode each name and value individually. You must also sort the parameters in the canonical query string alphabetically by key name. The sorting occurs after encoding.

Description of changes:

  • Sort query parameter keys after URI encoding in getCanonicalQuery

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@kuhe kuhe merged commit 806cc7f into smithy-lang:main Sep 20, 2024
11 checks passed
@kuhe
Copy link
Contributor

kuhe commented Sep 20, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants